package com.txhy.certificatechain.ui.activity.main;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.txhy.certificatechain.R;

import java.util.Timer;
import java.util.TimerTask;

import butterknife.ButterKnife;

/*
 * -----------------------------------------------------------------
 * Copyright (C) 2014-2016, by your company, All rights reserved.
 * -----------------------------------------------------------------
 * 文    件: AdvertisActivity.java
 * 作    者: 侯建军
 * 版    权: 1.0.0
 * 描    述: 广告页
 * 创建时间: 2018/9/19 15:18
 * 更新时间：2018/9/19 15:18
 * -----------------------------------------------------------------
 * 2018/9/19 15:18 : 创建 AdvertisActivity.java (侯建军);
 * -----------------------------------------------------------------
 */
public class AdvertisActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //设置无标题栏
//        getSupportActionBar().hide();
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //设置为全屏模式
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        //设置为无标题栏
        setContentView(R.layout.activity_advertis);
        ButterKnife.bind(this);
        initView();
    }
    private void initView() {
        //创建Timer对象
        Timer timer = new Timer();
        //创建TimerTask对象
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                Intent intent = new Intent(AdvertisActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        };
        //使用timer.schedule（）方法调用timerTask，定时3秒后执行run
        timer.schedule(timerTask, 2000);

        findViewById(R.id.img_jump).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(AdvertisActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        });
    }
}
